package com.aaa.mapper;

import com.aaa.entity.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface RoleMapper {
    //查询角色sql接口
    List<Role> query(String role);
    //查询角色名唯一
    @Select("select r.role from hotels.role r where role=#{role};")
    List<Map<String,Object>> find(@Param("role") String role);
    //添加角色信息
    @Insert("insert into hotels.role  (role) values (#{role});")
    int add(String role);

    @Select("select rid from staff_role where sid=#{id}")
    Integer  roleById(Integer id);

    @Select("select * from role")
    List<Role> findAll();


    @Delete("delete from staff_role where sid=#{id} ")
    void delroleById(Integer id);


    Integer addRole(Integer id, Integer sid);

}
